//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package weaver.interfaces.expense.action.gzc.th;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.util.ExpenseInfoUtil;

public class SJHCGZSQ_TH_ExpenseAction extends BaseBean {
    public SJHCGZSQ_TH_ExpenseAction() {
    }

    public void execute(String workflowid, String requestid) {
        this.writeLog("进入SJHCGZSQ_TH_ExpenseAction-----------" + requestid);
        RecordSet rs = new RecordSet();
        rs.executeSql("select formid from workflow_base where id = " + workflowid);
        rs.next();
        String formid = rs.getString("formid");
        String formtable = "formtable_main_" + formid.replaceAll("-", "");
        String ccode = "";
        double amount = 0.0D;
        String cexpenseitemcode = "";
        String citemcode = "";
        String ly = "";
        String iyear = "";
        String sql = "select a.id,b.ks,a.zcxm,a.jine2,b.sqrq,b.kth1,zj from " + formtable + "_dt1 a , " + formtable + " b where a.mainid=b.id and  b.requestid=" + requestid;
        writeLog("===============查询预算信息发送的SQL："+sql);
        rs.execute(sql);
        ExpenseInfoUtil expenseInfoUtil;
        String kth = null;
        String iskt = null;

        for(; rs.next(); expenseInfoUtil.releaseExpense2(workflowid, ccode, cexpenseitemcode, citemcode, kth, amount, iyear, iskt)) {

            expenseInfoUtil = new ExpenseInfoUtil();
            ccode = expenseInfoUtil.getKsbm(Util.null2String(rs.getString("ks")));
            amount = Util.getDoubleValue(rs.getString("jine2"), 0.0D);
            cexpenseitemcode = Util.null2String(rs.getString("zcxm"));
            kth = Util.null2String(rs.getString("kth1"));
            ly = Util.null2String(rs.getString("zj"));
            iyear = Util.null2String(rs.getString("sqrq")).substring(0, 4);
            iskt = "0";
            if("0".equals(ly) || "6".equals(ly)) {
                iskt = "1";
            }

            if("1".equals(ly)) {
                iskt = "1";
            }
            writeLog("====参数信息："+workflowid+"=="+ccode+"=="+cexpenseitemcode+"=="+citemcode+"=="+kth+"=="+amount+"=="+iyear+"=="+iskt);
        }

    }
}
